package com.GUI.lesson01;

import java.awt.*;
import java.awt.event.WindowAdapter;
import java.awt.event.WindowEvent;

public class TextFinal {
    public static void main(String[] args) {
        Frame frame = new Frame("TextFinal");

        frame.setLayout(new GridLayout(2,1));

        //四个面板
        Panel panel1 = new Panel(new BorderLayout());//第一排
        Panel panel2 = new Panel(new GridLayout(2,1));//第一排第二列
        Panel panel3 = new Panel(new BorderLayout());//第二排
        Panel panel4 = new Panel(new GridLayout(2,2));//第二排第二列

        //八个按钮
        Button b1 = new Button("b1");
        Button b2 = new Button("b2");
        Button b3 = new Button("b3");
        Button b4 = new Button("b4");
        Button b5 = new Button("b5");
        Button b6 = new Button("b6");
        Button b7 = new Button("b7");
        Button b8 = new Button("b8");
        Button b9 = new Button("b9");
        Button b10 = new Button("b10");

        frame.add(panel1);
        frame.add(panel3);
        //第一行
        panel1.setLayout(new GridLayout(1,3));
        panel1.add(b1);
        panel1.add(panel2);
        panel2.add(b3);
        panel2.add(b4);
        panel1.add(b2);
        //第二行
        panel3.setLayout(new GridLayout(1,3));
        panel3.add(b5);
        panel3.add(panel4);
        panel4.add(b6);
        panel4.add(b7);
        panel4.add(b8);
        panel4.add(b9);
        panel3.add(b10);


        //设置可见
        frame.setVisible(true);
        //设置大小
        frame.setSize(500,400);
        //关闭
        frame.addWindowListener(new WindowAdapter() {
            @Override
            public void windowClosing(WindowEvent e) {
                System.exit(0);
            }
        });
    }
}
